package util;

import domain.Task;

import java.util.Comparator;
import java.util.Date;

/**
 * User: Алексей
 * Date: 21.11.12
 * Time: 12:42
 */
public class DateComparator implements Comparator<Task> {

    @Override
    public int compare(Task o1, Task o2) {
        if ((new Date()).compareTo(o1.getDate()) >= 0)
            return 1;
        if ((new Date()).compareTo(o2.getDate()) >= 0)
            return -1;
        return o1.getDate().compareTo(o2.getDate());
    }
}
